﻿using System;
using System.Web.Mail;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using MLY;
using MLY.Dal;
using MLY.Bll;
using System.IO;
namespace MLY.Reports.DataReports
{
    public partial class ErrorsLog : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // direction
                if (SessParam.Culture == "he")
                {
                    //cssLiteral.Text = @"<link type=""text/css"" rel=""stylesheet"" href=""/Style/Rtl_Stylesheet.css"" />";
                    DirectionPanel.Direction = ContentDirection.RightToLeft;
                }
                else
                {
                    //cssLiteral.Text = @"<link type=""text/css"" rel=""stylesheet"" href=""/Style/Ltr_Stylesheet.css"" />";
                    DirectionPanel.Direction = ContentDirection.LeftToRight;
                }

                DemoPanel.Visible = (Session["UserId"].ToString() == "39");
            }
        }

        protected void GenerateReport(object sender, EventArgs e)
        {
            DateTime From = DateTime.Parse(txtFromDate.Text.Trim());
            DateTime Till = DateTime.Parse(txtToDate.Text.Trim());

            if (From > Till)
            {
                DateTime tmp = From;
                From = Till;
                Till = tmp;
            }

            List<Dal.logTbl> lst = MLY.Bll.ReportsGenerator.SystemErrorsReport(From, Till);

            ReportPanel.Visible = true;
            ErrorsGridview.DataSource = lst;
            ErrorsGridview.DataBind();
        }
    }
}
